import React, { useState } from "react";
import { Space, Badge } from "antd";
export default function RelationAndSubTableOptions(props) {
  const { control, value } = props;
  const [show, setShow] = useState(true); 
  //多选关联

  let Subtable = [];
  let SubtableCount = 0;

  try {
    Subtable = value ? JSON.parse(value) : [];
    if (Array.isArray(Subtable)) {
      SubtableCount = Subtable.length;
    } else {
      SubtableCount = Number(value);
    }
  } catch (error) {
    console.error("无效的JSON数据:", error);
    return <div>成员组件解析异常.</div>;
  }

  return (
    <div>
      <Space>
        <Badge
          count={show ? SubtableCount : 0}
          style={{
            backgroundColor: "#bbbbbb",
          }}
        />
      </Space>
    </div>
  );
}
